﻿/*-----------------------------------------------
// File: BCAttackReadyState.cs 
// Description: 渲染层，英雄对象的攻击准备。Tips：在初始位置，接收Behaviour
// Author: Shaobing	492057342@qq.com
-----------------------------------------------*/
using UnityEngine;
using System.Collections;

namespace Battle.View
{
    public class BCAttackReadyState : Fsm.FsmStateMonoBase<ActorState> 
    {
        BattleCharacter bc {
            get { return this.controller as BattleCharacter; }
        }
        public BCAttackReadyState(ActorState state, BattleCharacter ctrl) : base(state, ctrl) {
        }

        public override void Enter()
        {
            bc.transform.SetParent(BattleViewCtrl.GetInstance().transform);
            bc.transform.localPosition = bc.GetStandPosition();
            bc.transform.localEulerAngles = bc.GetStandEulerAngle();
            bc.transform.localScale = Vector3.one;
            //Debug.Log("jumpb time: "+bc.anim.anim["jumpb"].time);
            if(!bc.anim.anim.IsPlaying(AniName.IDLE_FIGHT))
            {
                bc.anim.anim[AniName.IDLE_FIGHT].wrapMode = WrapMode.Loop;
                bc.anim.anim.CrossFade(AniName.IDLE_FIGHT, 0.3f);
            }
            //bc.PlayStand();
        }
        public override void Update()
        {
            if (bc.IsHavePackageNeedDo()) {
                var package = bc.DequeuePackage();
                bc.DoPackage(package);
            }
        }

    }

}